Skip to content

Conversation

@kolkov
Copy link
Contributor

@kolkov kolkov commented Jan 29, 2026

Summary

Complete the gputypes integration with comprehensive fixes for wgpu-native v27 compatibility.

Code Fixes

  • Conversion layer (wgpu/convert.go): ~45 TextureFormats, ~30 VertexFormats, VertexStepMode, TextureSampleType, TextureViewDimension
  • Struct padding: Fix FFI alignment in bindgroup wire structs (sampler, texture, storage)
  • PipelineLayout: Use CreatePipelineLayoutSimple in 4 examples
  • GetModuleHandleW: Fix kernel32.dll usage in 8 Windows examples
  • Defaults: sampler MaxAnisotropy >= 1, texture SampleCount/MipLevelCount >= 1
  • render_bundle: Fallback shader without primitive_index (works on all GPUs)

Documentation Updates

  • CHANGELOG.md: Document all v0.2.0 fixes
  • README.md: Update wgpu-native version to v27.0.4.0
  • ROADMAP.md: Modernized following GitHub best practices (disclaimer, phase labels, How to Contribute)
  • examples/README.md: Update version, add gputypes note

Test Plan

  • All 76+ tests pass
  • All 11 examples build and run
  • Linter passes (only expected gocyclo warnings for large switch statements)

Result

All examples now work on all supported hardware:

  • ✅ triangle, colored-triangle, cube, rotating-triangle
  • ✅ textured-quad, mrt, indirect, instanced
  • ✅ render_bundle (with fallback shader)
  • ✅ compute, adapter_info, buffer_introspection, error_handling, etc.

Conversion layer fixes:
- TextureViewDimension values match between gputypes and wgpu-native v27
- Add struct padding for FFI alignment (sampler/texture/storage binding layouts)
- Fix VertexFormat, VertexStepMode, TextureSampleType conversions

Example fixes:
- Use CreatePipelineLayoutSimple in cube, rotating-triangle, mrt, textured-quad
- Fix GetModuleHandleW: use kernel32.dll instead of user32.dll (8 examples)
- render_bundle: fallback shader without primitive_index (works on all GPUs)

Default value fixes:
- sampler: MaxAnisotropy >= 1
- texture: SampleCount >= 1, MipLevelCount >= 1

All 11 examples now work on all supported hardware.
CHANGELOG.md:
- Document conversion layer and all fixes

README.md:
- Update wgpu-native version to v27.0.4.0

ROADMAP.md (modernized following GitHub best practices):
- Add disclaimer about plans vs commitments
- Use phase labels instead of hardcoded dates
- Add How to Contribute section
- Link to GitHub Issues/Projects for live tracking
- Add upstream dependencies tracking

examples/README.md:
- Update version to 0.2.0
- Add gputypes note
Conversion functions (toWGPUTextureFormat, fromWGPUTextureFormat,
toWGPUVertexFormat) have large switch statements for enum mapping
which are inherently high complexity but straightforward.

CreateRenderPipeline has high complexity due to wire struct
initialization but is a single-purpose function.

Exclude convert.go and render_pipeline.go from gocyclo/cyclop/funlen
checks since these patterns are acceptable for FFI conversion code.
@kolkov kolkov force-pushed the feat/gputypes-integration-fixes branch from e74fe37 to 6863de4 Compare January 29, 2026 14:17
@kolkov kolkov merged commit 04064eb into main Jan 29, 2026
6 checks passed
@kolkov kolkov deleted the feat/gputypes-integration-fixes branch January 29, 2026 14:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants